<?php $this->load->view('header/standard'); ?>
<div id="main">
    <div class="container">
        <div class="span-17 colborder" id="content">
            <?php if (isset($messages)) echo $messages; ?>

            <div id="submenu-container" class="span-17 last">
                <?php $this->load->view('menu/profile'); ?>
            </div>

            <?php echo form_open('profile/license/delete/'.$person->id); ?>
                
	            <?php if (count($pilot->Licenses) == 0): ?>
                    <div class="span-15 last">
                        <p class="last"><?=lang('home.No_licences_assigned')?></p>
                        <?php if ($isAdmin): ?>
                       <span class="span-3 last"><?php echo anchor('profile/license/add/'.$person->id, lang('profile.license.Add'))?></span>
                       <?php endif; ?>
                    </div>
	            <?php else: ?>
	                <?php foreach ($pilot->Licenses as $l): ?>
	                <div class="box span-8">
	                    <h4><?=lang('profile.license.Number')?>: <?php echo $l->PilotLicenseModel[0]->number; ?></h4>
	                    <dl>
		                    <dt class="caps"><?=lang('profile.license.Issued')?>: </dt>
		                    <dd><?php echo $l->PilotLicenseModel[0]->issued; ?></dd>
		                    <dt class="caps prepend-top"><?=lang('profile.license.Renewed')?>: </dt>
		                    <dd><?php echo $l->PilotLicenseModel[0]->renewed; ?></dd>
		                    <dt class="caps prepend-top"><?=lang('profile.license.Expires')?>: </dt>
		                    <dd><?php echo $l->PilotLicenseModel[0]->expires; ?></dd>
		                    <dt class="caps prepend-top"><?=lang('profile.license.Examiner')?>: </dt>
		                    <dd><?php echo $l->PilotLicenseModel[0]->Examiner->name; ?></dd>
	                    </dl>
	                </div>
	                <div class="box span-8 last">
	                    <h4>
	                        <?php if ($isAdmin): ?><?php echo form_checkbox('lid_'.$l->id, 'lid_'.$l->id)?> <?php endif; ?>
	                        <?=lang('profile.license.Details')?>
	                    </h4>
	                    <dl>
		                    <dt class="caps prepend-top"><?=lang('profile.license.Issuer')?>: </dt>
		                    <dd><?php echo $l->issuer; ?></dd>
		                    <dt class="caps prepend-top"><?=lang('profile.license.Level')?>: </dt>
		                    <dd><?php echo $l->level; ?></dd>
		                    <dt class="caps prepend-top"><?=lang('profile.license.Description')?>: </dt>
		                    <dd><?php echo nl2br($l->description); ?></dd>
	                        <?php if ($isAdmin): ?>
	                        <dt>&nbsp;</dt>
                            <dd>
                                [ <?php echo anchor('profile/license/edit/'.$person->id.'/'.$l->id, lang('profile.license.Edit'))?> | 
                                  <?php echo anchor('profile/license/delete/'.$person->id.'/'.$l->id, lang('profile.license.Delete'))?> ]
                            </dd>
	                        <?php endif; ?>
                        </dl>
	                </div>
	                <?php endforeach; ?>
	                <?php if ($isAdmin): ?>
	                <div class="span-16 last form-actions-panel">
	                   <?php echo anchor('profile/license/add/'.$person->id, lang('profile.license.Add'))?> | 
	                   <?php if ($isAdmin) echo form_submit('action', lang('profile.license.Delete')); ?>
	                </div>
	                <?php endif; ?>
	            <?php endif; ?>
            
            <?php echo form_close(); ?>
        </div> <!-- end content -->
        <div class="span-6 last" id="sidebar">
          <?php $this->load->view('menu/sidebar', array('person' => $person, 'context' => 'profile/license'))?>
        </div> <!-- end sidebar -->
    </div> <!-- end container -->
</div> <!-- end main -->
<?php $this->load->view('footer/standard');?>
